﻿ @if (Request.IsAuthenticated)
{
    
        <ul class="nav pull-right">    
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">@User.Identity.Name<b class="caret"></b></a>
                <span id="spanUserName" style="display:none">@User.Identity.Name</span>
                @if (User.IsInRole("Admin"))
                {
                <ul class="dropdown-menu">
                    <li><a href="/Account/Manage">Manage Account</a></li>
                    <li><a href="/Admin/Sites">Manage Sites</a></li>
                    <li><a href="/Admin/Users">Manage Users</a></li>
                    <li><a href="/Admin/Configuration">Configuration</a></li>
                    <li><a href="/Admin/Reports">Reports</a></li>
                    <li>@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) {
                        @Html.AntiForgeryToken()
                        <a class="dropddown-menu" href="javascript:document.getElementById('logoutForm').submit()">Log off</a> }
                    </li> 
                </ul>
                }
                else
                {                    
                    <ul class="dropdown-menu">
                        <li>@Html.ActionLink("Manage Account", "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })</li>
                        @if (ViewBag.Name != null)
                        {
                            <li>@Html.ActionLink("My Wish List", "Index", (string)ViewBag.Name + "/MyWishList")</li>
                            <li>@Html.ActionLink("My Stuff", "Index", (string)ViewBag.Name + "/MyStuff")</li>
                        }
                        <li>@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) {
                            @Html.AntiForgeryToken()
                            <a class="dropddown-menu" href="javascript:document.getElementById('logoutForm').submit()">Log off</a> }
                        </li> 
                    </ul>                        
                }
            </li>
        </ul>    
}
else
{  
    <ul class="nav pull-right">  
        <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
        <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>    
    </ul>   
}
